﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LabManagement.Data.DataUtilities
{
    public class CategoryUtils : BaseDataUtils
    {
        public CategoryUtils(DataManager bridge) : base(bridge) { }

        public IEnumerable<Category> Categories(Guid? CategoryId=null,int? pageNo=null,int?pagesize=null){
           var _categories = this.Bridge.DataFactory.Categories.OrderBy(c => c.CategoryName);
            if (CategoryId.HasValue)
            {
                 _categories = this.Bridge.DataFactory.Categories.Where(c => c.CategoryId == CategoryId).OrderBy(c=>c.CategoryName);
                return _categories;
            }
            return _categories;
        }
        public IEnumerable<Category> ActiveCategories()
        {
            var _categories = this.Bridge.DataFactory.Categories.Where(c=>c.Active==true).OrderBy(c => c.CategoryName);           
            return _categories;
        }
    }
}
